package top.leinx.fxnotes.paint;

/**
 * @Author : xiaolei
 * @DateTime: 2021/3/27 6:31 下午
 */

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

import java.net.URISyntaxException;

public class ColorExample extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws URISyntaxException {
        StackPane colorPane = new StackPane();         // 创建一个栈空格
        Rectangle rectColor = new Rectangle(0, 0, 400, 300);
        rectColor.setFill(Color.RED);     // 设置填充颜色
        rectColor.setStroke(Color.BLACK); // 设置线条颜色
        rectColor.setStrokeWidth(3.0);    // 设置线条宽度
        colorPane.getChildren().add(rectColor);

        primaryStage.setTitle("Paint - Color 示例");
        primaryStage.setScene(new Scene(colorPane, 500, 400));
        primaryStage.show();
    }
}
